package com.soft.mainsite.module.category.dto;

import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.BeanUtils;
import com.soft.mainsite.module.category.entity.TCmsCategory;

/**
 * TCmsCategoryDto.java 此类用于网站栏目dto
 *
 * @author:刘兴家
 * @date:2019/4/15 
 * @remark:
 */
public class TCmsCategoryDto extends TCmsCategory{
	 public static List<TCmsCategoryDto> convertEntityToDtos(List<TCmsCategory> entityList) {
	        List<TCmsCategoryDto> dtoList = new ArrayList<>();
	        for (TCmsCategory entity : entityList) {
	            if (entity == null) {
	                continue;
	            }
	            dtoList.add(convertEntityToDto(entity));
	        }
	        return dtoList;
	    }

	    public static TCmsCategoryDto convertEntityToDto(TCmsCategory entity) {
	    	TCmsCategoryDto dto = new TCmsCategoryDto();
	        BeanUtils.copyProperties(entity, dto);
	        return dto;
	    }

	    public static List<TCmsCategory> convertDtoToEntitys(List<TCmsCategoryDto> dtoList){
	        List<TCmsCategory> entityList = new ArrayList<>();
	        for (TCmsCategoryDto dto : dtoList) {
	            if(dto == null){
	                continue;
	            }
	            entityList.add(convertDtoToEntity(dto));
	        }
	        return entityList;
	    }

	    public static TCmsCategory convertDtoToEntity(TCmsCategoryDto dto) {
	    	TCmsCategory entity = new TCmsCategory();
	        BeanUtils.copyProperties(dto, entity);
	        return entity;
	    }
}
